package queue;

import java.util.Random;

/**
 * @author zhaoziqiang
 * @Description:
 * @date 2020/8/19 19:45
 */
public class Main {
    public static void main(String[] args) {
        ArrQueue<Integer> arrQueue = new ArrQueue<>();
        getTime(arrQueue);
        LoopQueue<Integer> loopQueue = new LoopQueue<>();
        getTime(loopQueue);
    }

    public static void getTime(Queue q) {
        int initialCapacity = 1000;
        Random random = new Random();

        long start = System.currentTimeMillis();
        for (int i = 0; i < initialCapacity; i++) {
            q.enqueue( random.nextInt(1000));
        }
        for (int i = 0; i < initialCapacity; i++) {
            q.dequeue();
        }
        long end = System.currentTimeMillis();
        System.out.println("耗时："+(end-start)+"ms");
    }

}
